package com.ruoyi.system.service;

import com.dtflys.forest.annotation.BaseRequest;
import com.dtflys.forest.annotation.Get;
import com.dtflys.forest.annotation.Post;
import com.dtflys.forest.annotation.Query;
import com.ruoyi.system.domain.Forest.*;
import com.ruoyi.system.interceptor.TokenHeaderInterceptor;

@BaseRequest(
        baseURL = "${domain}"     // 默认域名
        ,interceptor = TokenHeaderInterceptor.class
)
public interface DeviceAsyncClient {

        @Get("/open/openapi/heat/read/info/${openId}/{deviceCode}")
        IotResult<ExtendDict<IotDeviceInfo>> getDeviceInfo(@Query("deviceCode") String deviceCode);

        @Get("/open/openapi/heat/read/info/page/${openId}")
        IotResult<IotPage<IotDeviceInfo>> getDeviceList(@Query("current") int page, @Query("size") int size);

        /*
                valveStatus 1 开阀 2 关阀 3 自由开度
                angle	阀门开度1-99, 仅在valveStatus为3时生效
         */
        @Post("/open/openapi/heat/valve/${openId}/{deviceCode}")
        IotResult<Object> setValve(@Query("deviceCode") String deviceCode, @Query("valveStatus") Integer valveStatus, @Query("angle") Integer angle);

        /**
         * 获取历史记录
         * @param deviceCode
         * @param page
         * @param size
         * @param startTime
         * @param endTime
         * @return
         */
        @Get("/open/openapi/heat/read/record/${openId}/{deviceCode}")
        IotResult<IotPage<IotDeviceInfo>> getDeviceHistory(@Query("deviceCode") String deviceCode,
                                                           @Query("current") int page,
                                                           @Query("size") int size,
                                                           @Query("startTime") String startTime,
                                                           @Query("endTime") String endTime
        );
}
